using System.ComponentModel;
using DevExpress.Utils.Drawing.Animation;
using DevExpress.XtraBars.Ribbon;
using DevExpress.XtraBars.Ribbon.Gallery;
using DevExpress.XtraBars.Ribbon.ViewInfo;

namespace Comteck.Winforms.Controls {
  /// <summary>
  /// 自定义图片列表
  /// </summary>
  [ToolboxItem(true)]
  public class MyGalleryControl : GalleryControl {
    /// <summary>
    /// 
    /// </summary>
    /// <returns></returns>
    protected override GalleryControlGallery CreateGallery() {
      return new MyGalleryControlGallery(this);
    }
  }

  /// <summary>
  /// 
  /// </summary>
  public class MyGalleryControlGallery : GalleryControlGallery {
    /// <summary>
    /// 
    /// </summary>
    /// <param name="galleryControl"></param>
    public MyGalleryControlGallery(GalleryControl galleryControl) : base(galleryControl) {
    }

    /// <summary>
    /// 
    /// </summary>
    /// <returns></returns>
    protected override BaseGalleryViewInfo CreateViewInfo() {
      return new MyGalleryControlGalleryViewInfo(this);
    }
  }

  /// <summary>
  /// 
  /// </summary>
  public class MyGalleryControlGalleryViewInfo : GalleryControlGalleryViewInfo {
    /// <summary>
    /// 
    /// </summary>
    /// <param name="gallery"></param>
    public MyGalleryControlGalleryViewInfo(GalleryControlGallery gallery) : base(gallery) {
    }

    /// <summary>
    /// 
    /// </summary>
    /// <param name="info"></param>
    /// <returns></returns>
    protected override bool ShouldAddAnimatedItem(GalleryItemViewInfo info) {
      var result = false;

      try {
        result = base.ShouldAddAnimatedItem(info);
      } catch {
      }

      return result;
    }

    /// <summary>
    /// 
    /// </summary>
    /// <param name="info"></param>
    protected override void OnAnimation(BaseAnimationInfo info) {
      try {
        base.OnAnimation(info);
      } catch {
      }
    }
  }
}
